package lws.com.liwushuo.adapter.shouye;

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import java.util.List;

import lws.com.liwushuo.R;

/**
 * Created by ZQ on 2016/10/17.
 */

public class SearchWordCompletedAdapter  extends RecyclerView.Adapter<SearchWordCompletedAdapter.MyHolder>{

    private Context context;
    private List<String> list;

    public SearchWordCompletedAdapter(Context context, List<String> list) {
        this.context = context;
        this.list = list;
    }

    @Override
    public MyHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(context).inflate(R.layout.shouye_search_wordcompleted_item, null);
        return new MyHolder(view);
    }

    @Override
    public void onBindViewHolder(MyHolder holder, int position) {
        holder.wordCompleteText.setText(list.get(position));
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public static class MyHolder extends RecyclerView.ViewHolder{
        private TextView wordCompleteText;
        public MyHolder(View itemView) {
            super(itemView);
            wordCompleteText=((TextView) itemView.findViewById(R.id.shouye_search_wordcompleted_itemText));
        }
    }
}
